package com.gccloud.design.feign;

import com.gccloud.design.entity.SdRepoParticipantConfEntity;
import com.gccloud.feign.filter.FeignRequestFilter;
import com.gccloud.starter.common.vo.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 实现功能【流程平台feign接口】
 *
 * @author hu.hongdou
 * @date 2022/2/21 17:21
 */
@FeignClient(name = "bwp-web-lowcode", path = "/bwp", configuration = {FeignRequestFilter.class})
public interface BwpOperDockingClient {

    @PutMapping(value = "/am", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    R saveSysUpdate(String JsonObj);

    @PostMapping(value = "/am", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    R saveSysInsert(String JsonObj);

    @DeleteMapping(value = "/am/{id}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    R deleteSysInsert(@PathVariable String id);

    @PostMapping(value = "/businessType", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    R saveBwpBusiType(String jsonObj);

    @PutMapping(value = "/businessType", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    R saveUpdateBwpBusiType(String jsonObj);

    @GetMapping(value = "/businessType/getChildDataOrNotByBusinessTypeId/{businessTypeId}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    R confirmBwpBusiType(@PathVariable String businessTypeId);

    @DeleteMapping(value = "/businessType/{id}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    R deleteBwpBusiType(@PathVariable String id);

    /**
     * 业务逻辑 页面
     */
    @RequestMapping(value = "/businessMgnt", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    R saveBusinessMgnt(String jsonObj);

    @DeleteMapping(value = "/businessMgnt/{id}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    R deleteBusinessMgnt(@PathVariable String id);

    /**
     * 页面模板方法
     */
    @RequestMapping(value = "/pageTemplate", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    R saveFormTemp(String jsonObj);

    @DeleteMapping(value = "/pageTemplate/{id}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    R deleteFormTempt(@PathVariable String id);

    /**
     * 流程操作方法
     */
    @RequestMapping(value = "/operation", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    R saveOptBtnBranch(String jsonObj);

    @PutMapping(value = "/operation", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    R updateOptBtnBranch(String jsonObj);

    @DeleteMapping(value = "/operation/{id}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    R deleteOptBtnBranch(@PathVariable String id);

    /**
     * 生成环节
     *
     * @param json
     * @return
     */
    @RequestMapping(value = "/activityRepo", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    R createRepo(String json);

    /**
     * 修改环节
     *
     * @param json
     * @return
     */
    @PutMapping(value = "/activityRepo", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    R updateRepo(String json);

    /**
     * 删除环节
     *
     * @param id 环节id
     * @return
     */
    @DeleteMapping(value = "/activityRepo/{id}")
    R deleteRepo(@PathVariable(value = "id") String id);

    /**
     * 保存环节参与人
     *
     * @param list
     * @return
     */
    @PostMapping(value = "/repoParticipant/saveParticipant", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    R saveParticipants(List<SdRepoParticipantConfEntity> list);

    /**
     * 删除环节配置参与人
     *
     * @param id
     * @return
     */
    @DeleteMapping(value = "/repoParticipant/removeParticipantConfByParticipantConfId/{id}")
    R delParticipantsById(@PathVariable String id);

    /**
     * 根据环节id查询环节配置参与人
     *
     * @param repoId
     * @return
     */
    @GetMapping(value = "/repoParticipant/getParticipantListByRepoId")
    R queryParticipantsByRepoId(@RequestParam(value = "repoId") String repoId);

    @GetMapping(value = "/action")
    R queryButtonList(@RequestParam("current") int current, @RequestParam("size") int size, @RequestParam("searchKey") String searchKey);

    @GetMapping(value = "/action/{id}")
    R getButtonByid(@PathVariable("id") String id);

    @GetMapping(value = "/am/getZtreeNodes", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    R getMenuById(@RequestParam(value = "id") String id);
}
